import { reactive } from "vue"

export enum DialogType {
    ADD = '0',
    EDIT = '1'
}

export interface IDialog {
    title: string,
    visible: boolean,
    width: string,
    height: string
}

export default function useDialog() {
    // 弹窗属性
    const dialog = reactive<IDialog>({
        title: '',
        visible: false,
        width: '630px',
        height: '280px'
    })
    // 弹窗展示
    const onShowDialog = () => {
        dialog.visible = true
    }
    // 弹窗关闭
    const onCloseDialog = () => {
        dialog.visible = false
    }
    // 弹窗确定
    const onConfirmDialog = () => {
        dialog.visible = false
    }

    return { dialog, onShowDialog, onCloseDialog, onConfirmDialog }
}